<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions">
    <h:head>
        <title>Edit Category Page</title>
    </h:head>
    <h:body>
        <ui:composition template="../Master/adminMaster.xhtml">
            <ui:define name="page-content">
                <h:panelGroup rendered="#{login.customer.membersRole == 2}">
                    <h:form id="form" class="form">
                        <fieldset class="grey">
                            <legend>Edit category</legend>
                            <p:messages id="messages" showDetail="true" closable="true" autoUpdate="true" severity="info, warn"/>
                            <pe:tooltip global="true" myPosition="left center" atPosition="right center" forSelector=".ui-state-error"/>
                            <table border="0" cellpadding="0" cellspacing="0" id="id-form">
                                <tr>
                                    <th valign="top" class="id-form-th"><label>Name:</label></th>
                                    <td class="id-form-td">
                                        <p:inputText value="#{categoryMBean.selectedCategory.categoryName}" 
                                                     id="categoryName" styleClass="larger" required="true"
                                                     title="#{component.valid ? '' : categoryMBean.getErrorMessage(component.clientId)}">
                                            <f:validateLength minimum="3" maximum="200"/>
                                        
                                        </p:inputText>
                                    </td>
                                    <td class="id-form-td"></td>
                                </tr>

                                <tr>
                                    <th valign="top" class="id-form-th"><label>Priority:</label></th>
                                    <td class="id-form-td">
                                        <h:selectOneMenu value="#{categoryMBean.selectedCategory.categoryPriority}">
                                            <f:selectItem itemLabel="High" itemValue="High"></f:selectItem>
                                            <f:selectItem itemLabel="Normal" itemValue="Normal"></f:selectItem>
                                            <f:selectItem itemLabel="Low" itemValue="Low"></f:selectItem>
                                        </h:selectOneMenu>

                                    </td>
                                    <td class="id-form-td"></td>
                                </tr>
                                <tr>
                                    <th class="id-form-th">&nbsp;</th>
                                    <td valign="top" class="id-form-td">
                                        <p:commandButton value="Save" actionListener="#{categoryMBean.editCategory}"
                                                         icon="ui-icon-disk" styleClass="grey"
                                                         update="form,form:messages" process="form"/>
                                        <p:commandButton type="reset" styleClass="grey" update="form,form:messages" value="Reset"/>
                                    </td>
                                    <td class="id-form-td"></td>
                                </tr>
                            </table>
                        </fieldset>
                    </h:form>

                </h:panelGroup>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

